'''
@Descripttion: 
@version: 
@encoding: utf-8
@Author: qiurongcan
Date: 2025-09-29 09:44:30
LastEditTime: 2025-09-29 10:21:48
'''


class Solution:
    def Find(self, target, array):
        if not array:
            return False
        
        # 逐行使用二分查找
        m = len(array)
        n = len(array[0])
        for i in range(m):
            if self.search(array[i], target):
                return True
        
        return False


    def search(self, arr, t):

        left, right = 0, len(arr) - 1

        while left <= right:
            mid = int(left + (right - left) / 2)
            if arr[mid] == t:
                return True
            elif arr[mid] < t:
                left = mid + 1
            
            else:
                right = mid - 1
        
        return False
